[4.22.1.0-shapeblue1] KVM: allow importVm to adopt an existing RBD (Ceph) root volume#141
[4.22.1.0-shapeblue1] KVM: allow importVm to adopt an existing RBD (Ceph) root volume#141harikrishna-patnala wants to merge 2 commits into
Conversation
importVm with importsource=shared on KVM failed to adopt an existing ROOT volume located on an RBD (Ceph) primary storage pool, returning "Disk not found or is invalid" (jobresultcode 530). Two changes fix this: 1. LibvirtCheckVolumeCommandWrapper only whitelisted file-based pools (Filesystem, NetworkFilesystem, SharedMountPoint) and inspected the volume with direct file reads (checkQcow2File / getVirtualSizeFromFile), which do not work on RBD. RBD is now supported: the volume is inspected through the RBD URI via qemu-img (the same approach already used by LibvirtGetVolumesOnStorageCommandWrapper, which backs listVolumesForImport), the QCOW2 check is skipped for raw RBD images, the virtual size is taken from the pool-reported disk, and the encrypted/backing-file/locked details are still collected so the management server import validations keep working. 2. VolumeOrchestrator.importVolume() and updateImportedVolume() hardcoded the KVM volume format to QCOW2. RBD-backed volumes are raw, so the format is now derived from the storage pool type (RBD -> RAW) through a single shared helper, applied at both import call sites. Unit tests: new LibvirtCheckVolumeCommandWrapperTest and additional VolumeOrchestratorTest cases for the format helper.
importVolume (managing a previously-unmanaged volume) routes through VolumeOrchestrator.importVolume() and therefore also benefits from the pool-type-aware format fix (RBD -> RAW). Add a VolumeImportUnmanageManagerImplTest case asserting the RBD pool type and KVM hypervisor are forwarded to the orchestrator.
|
The testing is NOT huge, relatively easy (for those who know what they are doing - but the UI needs to be renamed as well (not "Import QCOW2 from Shared Storage --> but something more generic and truetfull like e.g. "Build a VM from an existing volume on a shared storage" - notice "existing volume" vs "qcow2" and also notice the "Build a VM" - because we are NOT IMPORTING ANYTHING - bad wording - so let's play it nice - I guess same migh be considered for qcow from local storage - but in realitty local storage can only host qcow2 - so...probably no renamed needed there). Later, there will be a need to support using an existing e.g. Linstore volume ("from" a shared storage) and build a VM around it. Or Dell PowerFlex, or something else (StorePool), etc. |
Description
This PR is a duplicate of upstream PR apache#13365 to address the same in the ShapeBlue custom patch 4.22.1.0-shapeblue1
If the test efforts are huge we may drop this here and continue in upstream 4.22.2 or other release.
cc @andrijapanicsb
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?